﻿//==============================================================================
// File: LightweightPropertyContainer.cs
// Created: 2010-05-10
// Author: Piotr Włodek
//==============================================================================
// This file is a part of MAMMOTH project.
// Copyright (C) 2010 AGH University of Science and Technology, Krakow.
// https://caribou.iisg.agh.edu.pl/trac/mammoth
//
// Mammoth is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// Mammoth is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with WpfRcp. If not, see http://www.gnu.org/licenses/.
//==============================================================================

using System;
using WpfRcp.PropertyModel.Core;

namespace WpfRcp.PropertyModel
{
    /// <summary>
    /// Represents lightweight implementation of <see cref="IPropertyContainer"/> interface.
    /// </summary>
    /// <remarks>
    /// Does not support dynamic and attached properties.
    /// </remarks>
    [Serializable]
    public class LightweightPropertyContainer : PropertyContainer
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="LightweightPropertyContainer"/> class.
        /// </summary>
        protected LightweightPropertyContainer() : this(null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="LightweightPropertyContainer"/> class.
        /// </summary>
        /// <param name="parent">Parent container.</param>
        /// <remarks>
        /// If parent is specified, all internal events will contain the given parent
        /// rather than this instance. This is primary used for scenarios, where the developer
        /// does not want to (or can't) derive from <see cref="PropertyContainer"/> class. Also
        /// bear in mind that this constructor does not validate object upon its creation.
        /// </remarks>
        public LightweightPropertyContainer(IPropertyContainer parent) : base(parent, false)
        {
        }

        protected sealed override IMetaPropertyManager GetMetaPropertyManagerOverride(IPropertyContainer parent)
        {
            return new LightweightMetaPropertyManager(parent);
        }
    }
}